<template>
	<view class="container" :style="{minHeight:$height()}">
		<view class="list">
			<view class="item king-align__center king-flex__between" v-for="(item,index) in list" :key="item.id" @click="$next(`/pages/contract/fillContract?id=${item.id}`)" v-if="item.type == 0">
				<view class="king-align__center">
					<image class="icon" src="@/static/img/contract.png" mode="widthFix"></image>
					<view class="list-title u-line-1">{{item.company.name}}-{{item.name}}</view>
				</view>
				<i class="iconfont">&#xe63b;</i>
			</view>
			
		</view>
		<!-- 加载更多 -->
		<u-loadmore v-if="list.length !== 0" :status="status" :load-text="loadText" />
		<image v-else src="@/static/image/empty.png" mode="widthFix" class="is-empty"></image>
	</view>
</template>

<script>
	export default {
		data(){
			return{
				// 页面数据初始化状态
				loadText: {
					loadmore: '轻轻上拉，加载更多',
					loading: '努力加载中',
					nomore: '我也是有底线的'
				},
				more: false,
				page: 1, //页码
				limit: 15, //条数
				list:[],
			}
		},
		onShow() {
			
		},
		onLoad() {
			this.getTemplate()
		},
		methods:{
			getTemplate(){
				this.$axios.request(this.$api.getContractRes,"GET",{
					limit:this.limit,
					page:this.page,
					orderField: 'id',
					order: 'desc'
				}).then((val) => {
					uni.stopPullDownRefresh();
					this.list = this.page == 1 ? val.data.list : this.list.concat(val.data.list)
					if (Math.ceil(val.data.total / this.limit) > this.page) {
						this.more = true;
						this.page++
					} else {
						this.more = false;
					}
				})
			}
		}
		
	}
</script>

<style lang="scss" scoped>
	.list {
		background: #FFFFFF;
		padding: 0rpx 47rpx;
		margin-top: 20rpx;

		.item {
			border-bottom: 1px solid #eaeaea;
			padding: 47rpx 0rpx;
		}

		.item:last-child {
			border-bottom: none;
		}

		.icon {
			width: 38rpx;
		}

		.list-title {
			font-size: 26rpx;
			font-weight: 600;
			color: #333333;
			width:550rpx;
			line-height: 37rpx;
			margin-left: 29rpx;
		}

		i {
			color: #d6d6d6;
		}
	}
</style>